package com.itcast.java.coupon.controller;

import com.itcast.java.common.base.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.Collections;

/**
 * 写点什么？
 *
 * @author hrz
 * @since 2020/9/17 0017
 */
@RestController
@RequestMapping("/test")
public class DemoController {

    @GetMapping("/coupons/{userId}")
    public R<?> coupons(@PathVariable String userId) {
        if ("132".equals(userId)) {
            return R.ok(Arrays.asList("coupon1", "coupon2", "coupon3"));
        } else {
            return R.ok(Collections.EMPTY_LIST);
        }
    }

}
